<template>
  <transition name="fade">
    <div class="dialog" v-if="props.isShow">
      <img :src="props.imgUrl" alt="" />
      <div class="close" @click="shutDown"></div>
    </div>
  </transition>
</template>

<script setup>
const props = defineProps({
  isShow: {
    type: Boolean,
    default: false,
  },
  imgUrl: {
    type: String,
    default: "../assets/images/400x400.png",
  },
});
const emits = defineEmits(["shoutdown"]);
const shutDown = () => {
  emits("shutdown", false);
};
</script>

<style lang="scss" scoped>
.fade-enter-active, .fade-leave-active {  
    transition: opacity .5s;  
  }  
  .fade-enter, .fade-leave-to {  
    opacity: 0;  
  }  
.dialog {
  background-color: rgba(0, 0, 0, 0.8);
  width: calc(100vw);
  height: calc(100vh);
  position: fixed;
  z-index: 990;
  display: flex;
  justify-content: center;
  align-items: center;
  img {
    width: calc(60vw);
    height: calc(60vw);
    object-fit: contain;
    background-color: #fff;
  }
  .close {
    position: absolute;
    right: calc(6vw);
    top: calc(12vw);
    width: calc(6vw);
    height: calc(6vw);
    background: url("@/assets/images/shutdown.png") no-repeat;
    background-size: contain;
  }
}
</style>
